/*


class OutClass {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    static class InnerClass {
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;

        public void test() {
            OutClass outClass = new OutClass();

            System.out.println(outClass.data1);     //依赖对象
            System.out.println(outClass.data2);     //依赖对象

            System.out.println(data3);

            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);

            System.out.println("InnerClass::test()");
        }
    }
}

public class Test {
    public static void main(String[] args) {
        OutClass.InnerClass innerClass = new OutClass.InnerClass();

        innerClass.test();
    }
}
*/



/*class OutClass {
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;

    class InnerClass {
        public int data1 = 99;
        public int data4 = 4;
        private int data5 = 5;
        public  int data6 = 6;

        public void test() {
            System.out.println(data1);
            //OutClass.this  外部类的this
            System.out.println(OutClass.this.data1);
            System.out.println(data2);
            System.out.println(data3);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("InnerClass::test()");
        }
    }
}

public class Test {
    public static void main(String[] args) {

        //OutClass.InnerClass innerClass = new OutClass.InnerClass();      //静态内部类的引用

        *//*OutClass outClass = new OutClass();
        OutClass.InnerClass innerClass = outClass.new InnerClass();*//*        //实例内部类的引用

        OutClass.InnerClass innerClass = new OutClass().new InnerClass();
        innerClass.test();

    }
}*/


import java.util.Comparator;

//匿名内部类
class OuterClass {
    public void test(){
        System.out.println("OuterClass::test");
    }
}

interface ITestAble {
    void test();
}

class Student {
    public int age;
}

public class Test {

    public static void main(String[] args) {

        ITestAble iTestAble = new ITestAble() {
            @Override
            public void test() {
                System.out.println("重写test()方法！！！！");
            }
        };

        iTestAble.test();

        System.out.println("================");

        new Comparator<Student>(){

            @Override
            public int compare(Student o1, Student o2) {
                return o1.age - o2.age;
            }
        };
    }



    public static void main2(String[] args) {
        OuterClass out = new OuterClass(){
            @Override
            public void test() {
                System.out.println("重写test方法1！！！");
            }
        };
        out.test();
    }


    public static void main1(String[] args) {
    new OuterClass(){
        @Override
        public void test() {
            System.out.println("重写test方法！！！");
        }
    }.test();
    }
}















